import { Context } from 'koa'
import { callBack, encryptByPrivateKey, redirectWps, thirdToWps, userInfo, verifyAccountandPassword } from '../service/sso'
const Router = require('@koa/router')

export function api() {
  const router = new Router()
  // 指定路由
  router.get('/api/test/ping', async function (ctx: Context) {
    ctx.status = 200
    ctx.body = {
      result: 'ok'
    }
    return ctx
  })
  router.get('/api/v1/authorization/redirectToWps', redirectWps)
  router.get('/api/v1/authorization/callback', callBack)
  router.get('/api/v1/authorization/userInfo', userInfo)

  router.get('/api/v1/authorization/thirdToWps', thirdToWps)
  router.get('/api/v1/authorization/verifyAccountandPassword', verifyAccountandPassword)
  return router
}
